﻿@model BBICMS.Application.InputModels.Products.BLayoutIM
@{
    ViewBag.Title = "新建" + EntityNames.BLayout;
    ViewBag.PageTitle = ViewBag.Title + "_内容";
}

<div class="panel panel-default">
    <header class="panel-heading">
        <span class="glyphicon glyphicon-edit"></span> @ViewBag.Title
    </header>

    <section class="panel-body">

        @using (Ajax.BeginForm("AddBLayout", null, new AjaxOptions
        {

            HttpMethod = "POST",
            OnBegin = "onBeginSave",
            OnComplete = "onCompleteSave",

            OnSuccess = "updateSuccess"

        }, new { @class = "form-horizontal", role = "form" }))
        {

            @Html.AntiForgeryToken()
            @Html.ValidationSummary(true)

            <div class="form-group">
                @Html.LabelFor(model => model.Value, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Value, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.Value, ViewData).Watermark })

                    @Html.ValidationMessageFor(model => model.Value)
                </div>
            </div>


            <div class="form-group">
                @Html.LabelFor(model => model.Importance, new { @class = "col-md-2 control-label" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Importance, new { @class = "form-control", type = "number", placeholder = ModelMetadata.FromLambdaExpression(x => x.Importance, ViewData).Watermark })

                    @Html.ValidationMessageFor(model => model.Importance)
                </div>
            </div>


            <div class="form-group">
                <div class="col-md-5 col-md-offset-2">
                    <div class="checkbox">
                        <label>
                            @Html.CheckBoxFor(model => model.Active)  @Html.DisplayNameFor(model => model.Active)
                        </label>
                    </div>
                </div>
                <div class="col-md-5">
                    @Html.ValidationMessageFor(model => model.Active)
                </div>
            </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-md-10">
                        <button type="submit" class="btn btn-primary" id="btnSave"><i class="fa fa-save fa-fw"></i>  @Buttons.Add </button>
                        <a href="@Url.Action("BLayouts")" class="btn btn-default"><span class="glyphicon glyphicon-arrow-left"></span> @Buttons.Back</a>
                    </div>
                </div>

        }

    </section>
    <footer class="box-footer"></footer>

</div>



@section Footer {
    @Scripts.Render("~/bundles/jqueryvalWithBootstrap")


    <script>

        function onBeginSave() {
            $("#btnSave i").removeClass("fa-save").addClass("fa-spinner fa-spin");
        }
        function onCompleteSave() {
            $("#btnSave i").removeClass("fa-spinner fa-spin").addClass("fa-save");
        }

    function updateSuccess(data) {
        var title = '@ViewBag.Title';
        Common.ShowBox(data.Status, data.Message, title);
    }



    $(function () {
        //当前菜单
        //$('.mainmenu>li:nth-of-type(2)').addClass('nav-open').find('.submenu li:nth-of-type(2) a').addClass('active');
    });

    </script>
}




